﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.OleDb;
using System.Data.SqlClient;


namespace WebApplication1
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            MenuItem SeLoguer = NavigationMenu.Items[5];
            MenuItem CreerCompte = NavigationMenu.Items[6];
            MenuItem MonFrigo = NavigationMenu.Items[7];
            
            BtnDeconnecter.Visible = false;
            BtnMenuDuSoir.Visible = false;

            //String user = (String)Session["login"];
            LabelLogin.Visible = false;
            MonFrigo.Enabled = false;

            if (Session["login"] != null)
            {
                BtnDeconnecter.Visible = true;
                BtnMenuDuSoir.Visible = true;
                LabelLogin.Text = (String)Session["login"];
                LabelLogin.Visible = true;
               
                SeLoguer.Enabled = false;
                CreerCompte.Enabled = false;
                MonFrigo.Enabled = true;
            }

            
        }

        protected void NavigationMenu_MenuItemClick(object sender, MenuEventArgs e)
        {

        }

        protected void BtnDeconnecter_Click(object sender, EventArgs e)
        {
            Session["login"] = null;
            Session["nom"] = null;
            Session["prenom"] = null;
            Response.Redirect("~/Default.aspx");
        }

        protected void MenuDuSoir_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/MenuDuSoir.aspx");
        }
    }
}
